package com.ethink.warehouse.manager;

import com.ethink.framework.common.util.JacksonUtils;
import com.ethink.warehouse.api.info.LogisticsBizConfigInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

/**
 *
 * @Author: lzy
 * @Date: Created in 2022/12/6 10:42
 * ModifiedBy:
 * Version:
 */
@Slf4j
@Component
public class LogisticsBizConfigManager {
    public String getLogisticsBizConfigString(LogisticsBizConfigInfo logisticsBizConfigInfo) {
        if (logisticsBizConfigInfo == null) {
            return null;
        }
        return JacksonUtils.toJson(logisticsBizConfigInfo);
    }

    public LogisticsBizConfigInfo getLogisticsBizConfigInfo(String logisticsBizConfigString) {
        if (StringUtils.isBlank(logisticsBizConfigString)) {
            return new LogisticsBizConfigInfo();
        }
        return JacksonUtils.toObj(logisticsBizConfigString, LogisticsBizConfigInfo.class);
    }
}
